< previous page page_128 next page >

Page 128
End Type

Dim Aspects(3) As Long
The DrawTheObject and PrintTheObject functions are very similar. They only differ in that one refers to a picture control and the other to the printer object. The picture control already has its ScaleMode property set to 3 vbPixels, so there is no need to explicitly set it, as is done in the PrintTheObject function.
Private Function DrawTheObject(obj As Object)
   Dim r As RECT
   Dim res As Long
   r.Right = Picturel.ScaleWidth
   r.Bottom = Picturel.ScaleHeight
   res = OLEDraw(obj, Aspects(cmbAspect.ListIndex), Picturel.hdc, r)
   If res <> 0 Then
      Err.Raise res
   End If
End Function


Private Function PrintTheObject(obj As Object)
   Dim r As RECT
   Dim res As Long
   Printer.ScaleMode = vbPixels
   r.Right = Printer.ScaleWidth
   r.Bottom = Printer.ScaleHeight
   res = OLEDraw(obj, Aspects(cmbAspect.ListIndex), Printer.hdc, r)
   If res <> 0 Then
      Err.Raise res
   End If
   Printer.EndDoc
End Function


Private Sub cmdDrawText_Click()
   DrawTheObject Privatectll
End Sub

Private Sub cmdDrawWord_Click()
   DrawTheObject MonthView1
End Sub

 
< previous page page_128 next page >